package com.ag.zlw.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ag.bean.TbPlanGrade;
import com.ag.common.AgException;
import com.ag.common.IDUtil;
import com.ag.common.IIDService;
import com.ag.zlw.dao.TbPlanGradeDAO;
import com.ag.zlw.service.PlanGradeService;

/**
 * 预案等级
 * 
 * @author 钟龙伟
 * 
 */

@Service("PlanGradeService")
public class PlanGradeServiceImpl implements PlanGradeService {
	@Resource(name = "ZLWTbPlanGradeDAO")
	private TbPlanGradeDAO tbPlanGradeDAO;

	private String IDs;
	@Resource(name = "iDServiceImpl")
	private IIDService idservice;

	public void save(TbPlanGrade pgPlanGrade) throws AgException {
		IDs = (String) idservice.findTablePK(IDUtil.TB_PLAN_GRADE);
		pgPlanGrade.setPgId(IDs);
		tbPlanGradeDAO.save(pgPlanGrade);
	}

	public List<TbPlanGrade> findAll() {
		return tbPlanGradeDAO.findAll();
	}

	public void delete(TbPlanGrade pgPlanGrade) {
		TbPlanGrade tbPlanGrade = tbPlanGradeDAO
				.findById(pgPlanGrade.getPgId());
		tbPlanGrade.setA(IDUtil.DELETE);
		tbPlanGradeDAO.attachDirty(tbPlanGrade);
	}

	public void modify(TbPlanGrade pgPlanGrade) {
		tbPlanGradeDAO.attachDirty(pgPlanGrade);
	}
}
